<?php

/**
 * home actions.
 *
 * @package    ehockey
 * @subpackage home
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class homeActions extends sfActions
{
	/**
	 * Executes index action
	 *
	 * @param sfRequest $request A request object
	 */
	public function executeIndex(sfWebRequest $request)
	{
		$this->forwardIf($this->getUser()->getUsuario()->isAdmin(), sfContext::getInstance()->getModuleName() , 'admin');
		
		$this->forwardIf($this->getUser()->getUsuario()->isAuditor(), 'auditoria' , 'index');
		
		$this->partidos = Doctrine::getTable('Partido')->getPartidosByUser($this->getUser()->getUsuario());
		
		
	}

	public function executeAdmin(sfWebRequest $request) {
		// esto esta aca porque a veces se pierde la configuracion default
		$this->getUser()->setCulture('es_AR');
	}
	
	public function executePlanilla(sfWebRequest $request) {
		$this->forward('partidoAdmin' , 'planilla');
		
	}
	public function executeEnviar(sfWebRequest $request) {
		$this->forward('partidoAdmin' , 'edit');
		
	}
	
	public function executeValidar(sfWebRequest $request) {
		$this->partido = $this->getRoute()->getObject();
		LogPlanilla::logVistaPlanillaCompleta($this->getUser()->getUsuario(), $this->partido);
		
		$this->forward('validacionVisitante' , 'new');
	}
}
